package com.allenkerr.dao.impl;

import com.allenkerr.dao.BookRepositoryCustom;
import com.allenkerr.model.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.data.elasticsearch.core.query.CriteriaQuery;

import java.util.List;

/**
 * Created by 小柯 on 17/9/7.
 */
public class BookRepositoryImpl implements BookRepositoryCustom {

    @Autowired
    private ElasticsearchTemplate esTemplate;

    @Override
    public List<Book> findBooksByQuery(CriteriaQuery query) {
        return esTemplate.queryForList(query, Book.class);
    }
}
